const Sequelize = require('sequelize')
const sequelize = require('../mysql')
// const SubMenu = require('./subMenuModel')
class Api extends Sequelize.Model { }
Api.init({
  id: {
    type: Sequelize.INTEGER(11).UNSIGNED,
    autoIncrement: true,
    unique: true,
    primaryKey: true
  },
  subMenuId: {
    type: Sequelize.STRING(255),
    allowNull: false
  },
  menuId: {
    type: Sequelize.STRING(255),
    allowNull: false
  },
  projectId: {
    type: Sequelize.INTEGER(11).UNSIGNED,
    allowNull: false
  },
  name: Sequelize.STRING(100),
  apiUrl: Sequelize.STRING(200),
  headerJSON: Sequelize.STRING(2000),
  bodyJSON: Sequelize.STRING(2000),
  desc: Sequelize.STRING(1000),
  result: Sequelize.STRING(10000),
  postType: Sequelize.STRING(10)
}, { sequelize, modelName: 'api' })
// Api.belongsTo(SubMenu, { foreignKey: 'subMenuId', targetKey: 'id' })
// 添加 fk_companyname 到 User
// Api.sync({ force: true })
module.exports = Api
